﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="Add-City.aspx.cs" Inherits="Add_City" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
     <%--firm design--%>
    <link href="css/style-metro.css" rel="stylesheet" type="text/css" />
    <%--end from design--%>
    <%--search dropdown--%>
    <link rel="stylesheet" type="text/css" href="css/select2_metro.css" />
    <%--end search dropdown--%>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <div class="row-fluid">
        <div class="span12">
            <div class="portlet box green">
                <div class="portlet-title">
                    <div class="caption">
                        <i class="icon-reorder"></i>
                        <asp:Label runat="server" ID="lblHeader" Text="Add/Edit City"></asp:Label></div>
                </div>
                <asp:ValidationSummary ID="ValidationSummary2" runat="server" CssClass="alert alert-danger"
                    ValidationGroup="save" />
                <div class="portlet-body form">
                    <div id="divMessage" runat="server" class="generalMessage">
                    </div>
                    <div class="row-fluid">
                        <div class="span6 ">
                            <div class="control-group" id="divCountry">
                                <label class="control-label">
                                    <span class="Required">*</span>Country</label>
                                <div class="controls">
                                    <asp:DropDownList runat="server" ID="drpCountry" CssClass="m-wrap span12 select2_category country"
                                        DataValueField="Id" OnSelectedIndexChanged="OnCountryChange" AutoPostBack="true"
                                        DataTextField="Name">
                                    </asp:DropDownList>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row-fluid">
                        <div class="span6 ">
                            <div class="control-group" id="divState">
                                <label class="control-label">
                                    <span class="Required">*</span>State</label>
                                <div class="controls">
                                    <asp:DropDownList runat="server" ID="drpState" CssClass="m-wrap span12 select2_category state"
                                        DataValueField="Id" DataTextField="Name">
                                    </asp:DropDownList>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row-fluid">
                        <div class="span6 ">
                            <div class="control-group" id="divCity">
                                <label class="control-label">
                                    <span class="Required">*</span>City</label>
                                <div class="controls">
                                    <asp:TextBox runat="server" ID="txtCityName" CssClass="span12 city"></asp:TextBox>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="form-actions">
                        <asp:Button runat="server" ID="btnSave" OnClick="Save" Text="Save" CssClass="btn blue frmValidation" />
                        <asp:Button runat="server" ID="btnCancel" OnClick="Save" Text="Cancel" CssClass="btn"
                            PostBackUrl="~/city-List.aspx" />
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        $('.frmValidation').click(function () {
            var isError = "false";
            var country = $('#<%= drpCountry.ClientID %>').val();
            var state = $('#<%= drpState.ClientID %>').val();
            if (country == "" || country == "0") {
                $('.country').closest('#divCountry').addClass("error");
                isError = "true";
            }
            else {
                $('.country').closest("#divCountry").removeClass("error");
            }
            if (state == "" || state == "0") {
                $('.state').closest('#divState').addClass("error");
                isError = "true";
            }
            else {
                $('.state').closest("#divState").removeClass("error");
            }
            if ($('.city').val() == "") {
                $('.city').closest('#divCity').addClass("error");
                isError = "true";
            }
            else {
                $('.city').closest("#divCity").removeClass("error");
            }
            if (isError == "true") {
                $(".generalMessage").html('<strong>Error!</strong> Please check your validation in red.');
                $(".generalMessage").addClass("alert alert-danger");
                return false;
            }
        });
    </script>
    <%--Search dropdown--%>
    <script type="text/javascript" src="js/select2.min.js"></script>
    <script src="js/form-samples.js"></script>
    <script>
        jQuery(document).ready(function () {
            // initiate layout and plugins

            FormSamples.init();
        });
    </script>
    <%--end search drop down--%>
</asp:Content>
